$(function () {

    $('.flexslider').flexslider({
        animation: "slide",
        start    : function (slider) {
            //$('body').removeClass('loading');
        }
    });

    var showMesage = function (text) {
        noty({
            text        : text,
            type        : 'warning',
            dismissQueue: true,
            timeout     : 1000,
            layout      : 'topCenter',
            theme       : 'defaultTheme',
            maxVisible  : 10
        })
    };

    var projectId = $('#projectId').val();
    var mid = $('#mid').val();
    var wxno = $('#wxno').val();
    var ctx = $('#ctx').val();

    $('#book_btn').click(function () {
        var name = $('#name').val();
        var phone = $('#phone').val();
        if (!name) {
            showMesage('请输入姓名!');
            return;
        }
        if (!phone) {
            showMesage('请输入手机');
            return;
        }
        $.post(ctx + '/mobileweb/ktv/book',
            {projectId: projectId, mid: mid, wxno: wxno, name: name, phone: phone},
            function (rst) {
                if (rst.status == 'OK') {
                    window.location.href = _g.ok_link
                } else {

                    showMesage(rst.message);
                }
            });
    });


    $('#phone-call').click(function () {
        var phone = $(this).data('phone');
        if (phone) {
            window.location.href = "tel://" + phone;
        }
    });
});